package com.mjf.web.controller.common;

import com.mjf.cjt.service.CjtAuthService;
import com.mjf.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "获取token")
public class TokenController {

     @Autowired
     private CjtAuthService cjtAuthService;

     @GetMapping("/token")
    @ApiOperation(value = "根据orgId获取畅捷通token", notes = "根据orgId获取畅捷通token")
    @ResponseBody
    public AjaxResult doCjtToken(@RequestParam(value = "orgId") String orgId) {
        try {
//            return new ResponseVO("200", "执行成功", cjtAuthService.getToken(orgId), null);
            return AjaxResult.success("执行成功", cjtAuthService.getToken(orgId));
        } catch (Exception e) {
            e.printStackTrace();

        }
//        return new ResponseVO(ResponseCode.RESPONSE_CODE_TOKEN_EMPTY.getCode(), ResponseCode.RESPONSE_CODE_TOKEN_EMPTY.getMessage(), "", null);
         return AjaxResult.error("执行失败");
     }
}
